
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>递增</title>
    </head>
    <body>
        <button id="btn_1">-</button>
        <input style="width:40px;" value="1" id="input"/>
        <button id="btn_2">+</button>
        <script type="text/javascript">
        
        var i=1;
         btn_2.onclick = function(){
         if(i<10){
         i+=1;
        input.value=i;
    }
}
    
         btn_1.onclick = function(){
         if(i>0){
        i-=1;
        input.value=i;
     }
    }
</script>
库存10个
</body>
</html>





